package leetcode.code1310;

public class Solution {
	public int[] xorQueries(int[] arr, int[][] queries) {
		int len = arr.length;
		int[] sum = new int[len + 1];
		for (int i = 1; i <= len; i++) {
			sum[i] = sum[i - 1] ^ arr[i - 1];
		}
		int[] ans = new int[queries.length];
		for (int i = 0; i < queries.length; i++) {
			ans[i] = sum[queries[i][1] + 1] ^ sum[queries[i][0]];
		}
		return ans;
	}
}
